﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace lcmyjobs.Web.findjobs
{
    public partial class ListNewJobs : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Application["webid"] != null)
                {
                    this.Title = string.Format("{1}招聘网   {1}人才网   {1}求职网   {1}猎头网  {0}-最新招聘信息", Application["webname"].ToString(), Application["webregion"].ToString());
                    Bind(Convert.ToInt32(Application["webid"]));
                    BindIsFrist(Convert.ToInt32(Application["webid"]));
                }
            }
        }

        private void BindIsFrist(int atid)
        {

            int c_isfrist = 0;
            int c_reward = 0;
            int c_vip = 0;
            int c_hunter = 0;
            int c_newjob = 0;
            int c_workerclass = 0;


            DataSet ds = new lcmyjobs.BLL.enterprise_releasejob().GetJobsInfo(true, false, false, false, false, false, atid,1
                                                                              , 12,
                                                                              out c_isfrist, out c_reward, out c_hunter, out c_vip, out c_newjob,
                                                                              out c_workerclass);

            StringBuilder str = new StringBuilder(" <ul class='xsqz_nyul'> ");

            DataTable dt_isfrist = ds.Tables[0];

            foreach (DataRow row in dt_isfrist.Rows)
            {
                str.Append("<li><span class='jplf_ls'><a target='_blank' href='JobsInfo-"
                    + row["enterprise_rid"] + ".html" + "'>"
                    + lcmyjobs.BLL.Tools.GetStrSub(row["jobs_name"].ToString(), 6)
                    + "</a></span>&nbsp;&nbsp;"
                    + lcmyjobs.BLL.Tools.GetStrSub(row["name"].ToString(), 10)
                    + "</li>");

            }
            str.Append("</ul>");
            this.lit_ul_isfrist.Text = str.ToString();
        }

        private void Bind(int atid)
        {
            int c_isfrist = 0;
            int c_reward = 0;
            int c_vip = 0;
            int c_hunter = 0;
            int c_newjob = 0;
            int c_workerclass = 0;


            DataSet ds = new lcmyjobs.BLL.enterprise_releasejob().GetJobsInfo(false, false, false, false, true, false, atid,
                                                                              this.AspNetPager1.CurrentPageIndex, this.AspNetPager1.PageSize,
                                                                              out c_isfrist, out c_reward, out c_hunter, out c_vip, out c_newjob,
                                                                              out c_workerclass);

            DataTable dt_newjobs = ds.Tables[0];


            this.AspNetPager1.RecordCount = c_newjob;

            this.GridView1.DataSource = dt_newjobs;
            this.GridView1.DataBind();
            //fineui
            //Grid1.DataSource = dt_newjobs;
            //Grid1.DataBind();
        }



        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            if (Application["webid"] != null)
            {
                Bind(Convert.ToInt32(Application["webid"]));
            }

        }

    }
}